package fr.umlv.m2.recipes.ideas.dao.interfaces;

import android.database.sqlite.SQLiteDatabase;

/**
 * Define a DAO which is an entity in the MPD
 * @author Christophe Chillan
 *
 * @param <T>
 */

public interface RecipesConcreteDAOInterface<T> {
	/**
	 * Call when the DAO is created
	 * @param db
	 */
	public void onCreate(SQLiteDatabase db);
	/**
	 * Call when the DAO is upgraded
	 * @param db
	 */
	public void onUpgrade(SQLiteDatabase db);
	/**
	 * Use to insert a field in the database
	 * @param db
	 * @param bean
	 * @return long - the number of inserted lines 
	 */
	public long insert(SQLiteDatabase db, T bean);
	/**
	 * Use to update a field in the database
	 * @param db
	 * @param bean
	 * @param id
	 * @return integer - the number of updated lines
	 */ 
	public int update(SQLiteDatabase db, T bean, int id);
	/**
	 * Remove the entries with the specified id
	 * @param db
	 * @param id
	 * @return integer - the number of entries inserted
	 */
	public int removeWithId(SQLiteDatabase db, int id);
}
